using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class MenuMap : EntityTypeConfiguration<Menu>
	{
		public MenuMap()
		{
			// Primary Key
			this.HasKey(t => t.MenuID);

			// Properties
			this.Property(t => t.MenuID)
				.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
				
			this.Property(t => t.MenuName)
				.IsRequired()
				.HasMaxLength(50);
				
			this.Property(t => t.URL)
				.HasMaxLength(100);
				
			this.Property(t => t.ImgURL)
				.HasMaxLength(50);
				
			this.Property(t => t.MenuComment)
				.HasMaxLength(50);
				
			// Table & Column Mappings
			this.ToTable("Menu");
			this.Property(t => t.MenuID).HasColumnName("MenuID");
			this.Property(t => t.MenuName).HasColumnName("MenuName");
			this.Property(t => t.ParentID).HasColumnName("ParentID");
			this.Property(t => t.URL).HasColumnName("URL");
			this.Property(t => t.ImgURL).HasColumnName("ImgURL");
			this.Property(t => t.MenuGroup).HasColumnName("MenuGroup");
			this.Property(t => t.MenuLevel).HasColumnName("MenuLevel");
			this.Property(t => t.Sorting).HasColumnName("Sorting");
			this.Property(t => t.MainSortBy).HasColumnName("MainSortBy");
			this.Property(t => t.MenuComment).HasColumnName("MenuComment");
			this.Property(t => t.IsDelete).HasColumnName("IsDelete");
			this.Property(t => t.CreatBy).HasColumnName("CreatBy");
			this.Property(t => t.CreatTime).HasColumnName("CreatTime");
			this.Property(t => t.CreatStation).HasColumnName("CreatStation");
			this.Property(t => t.UpdateBy).HasColumnName("UpdateBy");
			this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
			this.Property(t => t.UpdateStation).HasColumnName("UpdateStation");
			this.Property(t => t.SystemID).HasColumnName("SystemID");
		}
	}
}

